//
//  DYSimilarPicTopView.m
//  PrivatePhoto
//
//  Created by PrivatePhoto Team on 2021.
//  Copyright © 2021年 PrivatePhoto Team. All rights reserved.
//

#import "DYSimilarPicTopView.h"

@interface DYSimilarPicTopView ()

@end

@implementation DYSimilarPicTopView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        [self configSubView];
    }
    return self;
}

- (void)configSubView{
    [self addSubview:self.picCountLabel];
    [self.picCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.centerY.mas_offset(0);
    }];
    [self addSubview:self.seletedBtn];
    [self.seletedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.centerY.mas_offset(0);
    }];
}

- (void)selectedBtnDidClick:(UIButton *)sender{
    sender.selected = !sender.selected;
    !self.seletedBtnBlock ?:self.seletedBtnBlock(sender.selected);
}

#pragma mark --- setter/getter

- (UILabel *)picCountLabel{
    if (!_picCountLabel) {
        _picCountLabel = [[UILabel alloc] init];
        _picCountLabel.textColor = [UIColor lightGrayColor];
        _picCountLabel.font = [UIFont systemFontOfSize:14];
        _picCountLabel.text = @"6张照片";
    }
    return _picCountLabel;
}

- (UIButton *)seletedBtn{
    if (!_seletedBtn) {
        _seletedBtn = [[UIButton alloc] init];
        _seletedBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [_seletedBtn setTitleColor:[UIColor colorWithHexString:@"#528CFF"] forState:UIControlStateNormal];
        [_seletedBtn setTitle:@"取消全选" forState:UIControlStateNormal];
        [_seletedBtn addTarget:self action:@selector(selectedBtnDidClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _seletedBtn;
}

@end
